<template>
  <div id="centerLeft1">
    <div class="bg-color-black">
      <div class="d-flex pt-2 pl-2">
        <span>
          <icon name="chart-bar" class="text-icon"></icon>
        </span>
        <div class="d-flex">
          <span class="fs-xl text mx-2">数据总览</span>
          <dv-decoration-3 class="dv-dec-3" />
        </div>
      </div>
      <!-- 4个主要的数据 -->
      <div class="d-flex bottom-data">
        <div
          class="item-box mt-2"
          v-for="(item, index) in numberData"
          :key="index"
        >
          <p class="text" style="text-align: center;">
            {{ item.text }}
          </p>
          <div class="d-flex" style="margin-left: 40px">
            <!--<span class="coin">￥</span>-->
            <dv-digital-flop class="dv-digital-flop" :config="item.number" />
          </div>
        </div>
      </div>
      <div class=" jc-center">
        <CenterLeft1Chart />
      </div>
    </div>
  </div>
</template>

<script>
import CenterLeft1Chart from './centerLeft1Chart'
export default {
  data() {
    return {
      numberData: [
        {
          number: {
            number: [59],
            toFixed: 0,
            textAlign: 'left',
            content: '{nt}',
            style: {
              fontSize: 24
            }
          },
          text: '在基地剧组数量(组)'
        },
        {
          number: {
            number: [23071],
            toFixed: 0,
            textAlign: 'left',
            content: '{nt}',
            style: {
              fontSize: 24
            }
          },
          text: '产业配置人员(人)'
        },
        {
          number: {
            number: [1635],
            toFixed: 0,
            textAlign: 'left',
            content: '{nt}',
            style: {
              fontSize: 24
            }
          },
          text: '基地工作人员数量(人)'
        }
      ]
    }
  },
  components: {
    CenterLeft1Chart
  },
  mounted() {
    // this.changeTiming()
  },
  methods: {
    changeTiming() {
      setInterval(() => {
        this.changeNumber()
      }, 3000)
    },
    changeNumber() {
      this.numberData.forEach((item, index) => {
        item.number.number[0] += ++index
        item.number = { ...item.number }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
$box-width: 530px;
$box-height: 380px;

#centerLeft1 {
  padding: 16px;
  height: $box-height;
  //width: $box-width;
  border-radius: 10px;
  .bg-color-black {
    height: $box-height - 30px;
    border-radius: 10px;
  }
  .text {
    color: #c3cbde;
  }
  .dv-dec-3 {
    position: relative;
    width: 100px;
    height: 20px;
    top: -3px;
  }

  .bottom-data {
    .item-box {
      & > div {
        padding-right: 5px;
      }
      font-size: 14px;
      float: right;
      position: relative;
      width: 32%;
      color: #d3d6dd;
      .dv-digital-flop {
        width: 150px;
        height: 30px;
      }
      // 金币
      .coin {
        position: relative;
        top: 6px;
        font-size: 20px;
        color: #ffc107;
      }
      .colorYellow {
        color: yellowgreen;
      }
      p {
        text-align: center;
      }
    }
  }

  .jc-center {
    width: 100%;
  }
}
</style>
